package com.state.self;

import java.util.Random;

public class UnHiredState extends EmployeeState {

    public AlibabaCompany alibabaCompany;

    public UnHiredState(AlibabaCompany alibabaCompany) {
        this.alibabaCompany = alibabaCompany;
    }

    @Override
    public void exam() {
        System.out.println("进行了考试");
        Random random = new Random();
         int chance = random.nextInt(2);
         if(chance==1){
             this.alibabaCompany.setEmployee(this.alibabaCompany.getHiredState());
         } else {
             System.out.println("未能通过考试");
             this.alibabaCompany.setEmployee(this.alibabaCompany.getUnHiredState());
         }
    }

    @Override
    public boolean isHire() {
        System.out.println("还未被录用，需要进行考试");
        return false;
    }

    @Override
    public void sendOffer() {
        System.out.println("暂无offer发送");
    }
}
